package mt.dummy;

import java.io.Serializable;

import mt.Order;
import mt.comm.ServerSideMessage;


/**
 * ServerMessage are the messages sent from clients to the server.
 * @author Pedro, Rita, Miguel
 *
 */



public class ServerMessage implements ServerSideMessage, Serializable{
 /**
         * 
         */
        private static final long serialVersionUID = 1L;

/**
  * The type of the Message. It may be: NEW_ORDER, CONNECTED, DISCONNECTED
  */
        private Type type;
        
        /**
          * The name of the client who sends the message to the server. 
          */
        
    private String senderNickname;
    
    /**
     * The order of the message.
     */
    
    private Order order;
        

/**
 * Constructor. Constructs a message contains a type (enum), the nickname of the sender (String), 
 * and, depending on the message type, a new order. 
 * @param type
 * @param senderNickname
 * @param order
 */
        public ServerMessage(Type type, String senderNickname, Order order){
                this.type=type;
                this.senderNickname=senderNickname;
                this.order=order;
        }
        
        
        @Override
        public Type getType() {
                return type;
        }

        @Override
        public String getSenderNickname() {
                return senderNickname;
        }

        @Override
        public Order getOrder() {
                return order;
        }

}